// pages/user/user.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 状态栏高度
    statusBarHeight: wx.getStorageSync('statusBarHeight') + 'px',
    // 导航栏高度
    navigationBarHeight: wx.getStorageSync('navigationBarHeight') + 'px',
    // 胶囊按钮高度
    menuButtonHeight: wx.getStorageSync('menuButtonHeight') + 'px',
    // 导航栏和状态栏高度
    navigationBarAndStatusBarHeight:
      wx.getStorageSync('statusBarHeight') +
      wx.getStorageSync('navigationBarHeight') +
      'px',
    imgHeight:"",
    userAvatarUrl:"",
  },


  onLoad: function (options) {
    let userId = options.openId
    let app = getApp()
    let systemInfo = wx.getSystemInfoSync()
    let screentHeight = systemInfo.screenHeight
    let imgHeight = Math.round(screentHeight * 0.4)
    this.setData({
      imgHeight : imgHeight + "px"
    })
    wx.request({
      url: app.globalData.url + '/user/getuser',
      
      data:{
        openId:userId,
      },
      success: result => {
        let user = result.data.data
        console.log(user)

        this.setData({
          user : user,
        })
      }
    })
    
    
    
  },
  quit: function () {
    wx.switchTab({
      url: '/pages/community/community',
    })
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {

  },
  onShareAppMessage: function () {

  }
})